package com.project.webservice.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.util.JSONUtils;
import com.project.webservice.dto.SearchGetQualityTidDayDto;
import com.project.webservice.dto.TbTidRunDayDto;
import com.project.webservice.entity.TbTidRunDay;
import com.project.webservice.mapper.TbTidRunDayMapper;
import com.project.webservice.service.TbTidRunDayService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class TbTidRunDayServiceImpl extends ServiceImpl<TbTidRunDayMapper, TbTidRunDay> implements TbTidRunDayService {
    @DS("rfidrun")
    public  IPage<TbTidRunDay> getTbTidRunDayByPage(Page page, TbTidRunDay tbTidRunDay){
        return baseMapper.selectPage(page, Wrappers.<TbTidRunDay>lambdaQuery());
    }
    /**
     * 电子标签营运质量报告(一张电子标签多天)
     * @param search
     * @return
     */
    @DS("rfidrun")
    public IPage<TbTidRunDayDto> getQualityTidDays(Page<TbTidRunDayDto> page, SearchGetQualityTidDayDto search){
        log.info("getQualityTidDays:{}", JSONUtils.writeExcludeNull(search));
        return baseMapper.getQualityTidDays(page,search);

    }

    /**
     * 电子标签营运质量报告(多张电子标签一天)exec RFID_RUN.dbo.GET_QUALITY_TIDs_DAY '{0}', '{1}', {2}, {3}
     * @param page
     * @param search
     * @return
     */
    @DS("rfidrun")
    public IPage<TbTidRunDayDto> getQualityTidsDay(Page<TbTidRunDayDto> page, SearchGetQualityTidDayDto search){
        log.info("getQualityTidsDay:{}", JSONUtils.writeExcludeNull(search));
        return baseMapper.getQualityTidsDay(page,search);
    }
}
